
<!DOCTYPE html>
<html lang="en">
<head>
 <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
 <meta http-equiv="Pragma" content="no-cache" />
 <meta http-equiv="Expires" content="0" />
 <meta charset="UTF-8">
 <title>添加管理员</title>
 <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
 <link rel="stylesheet" href="/layui.css"  media="all">
</head>
<body>
<div class="box">
 <h2>添加管理员</h2>

 <form type="post" action="">
 <div class="input_box">
  <input id="aname" type="text" name="aname" placeholder="请输入用户名">
 </div>
 <div class="input_box">
  <input id="apassword" type="password" name="apassword" placeholder="请输入密码">
 </div>
 <div id="error_box"><br></div>
 <div class="input_box">
  <button type="button" class="btn btn-primary" onclick="addAdministrator()">添加</button>
 </div>
 </form>
 
 
</div>
<style type="text/css">
	*{
 margin: 0;
 padding: 0;
 font-family: 微软雅黑;
 font-size: 12px;
}
.box{
 width: 390px;
 height: 320px;
 border: solid 1px #ddd;
 background: #FFF;
 position: absolute;
 left: 50%;
 top:42%;
 margin-left: -195px;
 margin-top: -160px;
 text-align: center;
}
.box h2{
 font-weight: normal;
 color:#666;
 font-size: 16px;
 line-height: 40px;
 overflow: hidden;
 text-align: center;
 border-bottom: solid 1px #ddd;
 background: #f7f7f7;
}
.input_box{
 width:350px;
 padding-bottom: 15px;
 margin: 0 auto;
 overflow: hidden;
}

</style><!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="/layui.all.js"></script>

<script type="text/javascript">
   function addAdministrator() {
       $.post("/addAdministrator",
           {
               aname:$("#aname").val(),
               apassword:$("#apassword").val(),
           },
           function (data,index, item) {
               var datares=eval(data);
               $("#aname").attr({value:""});
               if(datares.status){
                  layer.msg(datares.msg);
               }else {
                   layer.msg(datares.msg);
               }
           },"json")
   }

</script>
</body>
</html>
 